import request from '@/utils/request'

export function getRoleList(params) {
	return request({
		url: '/sys/role',
		params
	})
}

export function getCompanyInfo(companyId) {
	return request({
		url: `/company/${companyId}`
	})
}

export function deleteRole(id) {
	return request({
		url: `/sys/role/${id}`,
		method: 'delete'
	})
}

export function addRole(data) {
	return request({
		url: '/sys/role',
		data,
		method: 'post'
	})
}

export function updateRole(data) {
	return request({
		url: `/sys/role/${data.id}`,
		data,
		method: 'put'
	})
}

export function getRoleDetail(id) {
	return request({
		url: `/sys/role/${id}`
	})
}


// 给角色分配权限
export function assignPerm(data) {
	return request({
		url: '/sys/role/assignPrem',
		method: 'put',
		data
	})
}
